<%--
  @author Kusal Samarakoon
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<script type="text/javascript">
    $(function() {
        $('.land-table').dataTable({
            "sPaginationType": "full_numbers",
            "bDestroy": true,
            "oLanguage": {
                "sZeroRecords": $('#no-record').val(),
                "sLengthMenu": $('#display').val() + " _MENU_ " + $('#records').val(),
                "sSearch": $('#search').val(),
                //"sInfo": $('#showing').val() + " _START_ " + $('#to').val() + " _END_ " + $('#of').val() + " _TOTAL_ " + $('#entries').val(),
                "sInfo": "",
                "sInfoEmpty": $('#no-record').val(),
                "oPaginate": {
                    "sFirst": $('#first').val(),
                    "sLast": $('#last').val(),
                    "sNext": $('#next').val(),
                    "sPrevious": $('#previous').val()
                }
            },
            "fnDrawCallback": function() {
                if ($('.dataTables_paginate span span.paginate_button').size()) {
                    $('.dataTables_paginate')[0].style.display = "block";
                } else {
                    $('.dataTables_paginate')[0].style.display = "none";
                }
            }
        });
    });
</script>

<div id="agreement-module-title" class="module-home-title">
    <s:a href="landAlienationModuleHome.do"><img src="${pageContext.request.contextPath}/images/land-reg.png"
                                                        alt="Land Alienation"><span><s:label
            value="%{getText('land_alienation_module.label')}"/></span></s:a>
    <span class="module-title-breaker"> > </span>
    <s:a href="initApplicationAgreement.do"><img src="${pageContext.request.contextPath}/images/agreement.png"
                                                        alt="Agreement"><span><s:label
            value="%{getText('agreement_title.label')}"/></span></s:a>

</div>
<div class="page-title center-align">
    <h2><s:label value="%{getText('agreement_head.label')}"/></h2>
</div>
<table class="width-100 margin-10-auto table land-table">
    <thead>
    <tr class="center-align table-header">
        <th><s:label value="%{getText('applied_date.label')}"/></th>
        <th><s:label value="%{getText('applicant_name.label')}"/></th>
        <th><s:label value="%{getText('type.label')}"/></th>
        <th><s:label value="%{getText('action.label')}"/></th>
    </tr>
    </thead>
    <tbody>
    <s:iterator status="status" value="landApplicationList">
        <tr class="<s:if test="#status.odd == true">table-row-odd</s:if><s:else>table-row-even</s:else>">

            <td class="center-align"><s:property value="submitDate"/></td>
            <td class="center-align"><s:property value="holder.name"/></td>
            <s:if test=" language=='si' ">
                <td class="center-align"><s:property value="preferredAlienationMethod.siName"/></td>
            </s:if>
            <s:elseif test=" language=='ta' ">
                <td class="center-align"><s:property value="preferredAlienationMethod.taName"/></td>
            </s:elseif>
            <s:else>
                <td class="center-align"><s:property value="preferredAlienationMethod.enName"/></td>
            </s:else>
            <td class="center-align">
                <s:url id="getAgreementType" action="getAgreementType">
                    <s:param name="applicationId" value="id"/>

                </s:url>
                <s:a href="%{getAgreementType}" title="%{getText('view_agreement_tooltip')}">
                    <img src="<s:url value='/images/agreement.png'/>" border="none" width="25"
                         height="25"/>
                </s:a>

                <s:url id="attachAlienationDoc" action="attachAlienationDoc">
                    <s:param name="applicationId" value="id"/>

                </s:url>
                <s:a href="%{attachAlienationDoc}" title="%{getText('attached_alienation_doc.label')}">
                    <img src="<s:url value='/images/attachment.png'/>" border="none" width="25"
                         height="25"/>
                </s:a>

            </td>
        </tr>
    </s:iterator>
    </tbody>
</table>
<%-- Localization text for data tables --%>
<s:hidden id="display" value="%{getText('display.label')}"/>
<s:hidden id="records" value="%{getText('records.label')}"/>
<s:hidden id="search" value="%{getText('search.label')}"/>
<s:hidden id="no-record" value="%{getText('no_record.label')}"/>
<s:hidden id="showing" value="%{getText('showing.label')}"/>
<s:hidden id="to" value="%{getText('to.label')}"/>
<s:hidden id="of" value="%{getText('of.label')}"/>
<s:hidden id="entries" value="%{getText('entries.label')}"/>
<s:hidden id="first" value="%{getText('first.label')}"/>
<s:hidden id="last" value="%{getText('last.label')}"/>
<s:hidden id="next" value="%{getText('next.label')}"/>
<s:hidden id="previous" value="%{getText('previous.label')}"/>